package fileReader.demo.reader;

/**
 * This class defines a box with four defined corners
 * Class is used to define bounding boxes.
 *
 * @author Mari Puhakka
 * @version 0.1
 */

public class Box {
	
	private double xMin;
	private double yMin;
	private double xMax;
	private double yMax;
	
	Box()
	{
		
	}
	
	Box(double xMini, double yMini, double xMaxi, double yMaxi )
	{
		xMin = xMini;
		yMin = yMini;
		xMax = xMaxi;
		yMax = yMaxi;
	}
	
	/**
	   * Method for getting the value of minimum x value.
	   *
	   * @return minimum value of x
	   */
	public double getXMin()
	{
		return xMin;
	}
	
	/**
	   * Method for getting the value of minimum y value.
	   *
	   * @return minimum value of y
	   */
	public double getYMin()
	{
		return yMin;
	}
	
	/**
	   * Method for getting the value of maximum x value.
	   *
	   * @return maximum value of x
	   */
	public double getXMax()
	{
		return xMax;
	}
	
	/**
	   * Method for getting the value of maximum y value.
	   *
	   * @return maximum value of y
	   */
	public double getYMax()
	{
		return yMax;
	}
	
	/**
	   * Method for setting the value of minimum x value.
	   *
	   * @param xMin minimum value of x to set
	   */
	public void setXMin(double xMin)
	{
		this.xMin = xMin;
	}
	
	/**
	   * Method for setting the value of minimum y value.
	   *
	   * @param yMin minimum value of y to set
	   */
	public void setYMin(double yMin)
	{
		this.yMin = yMin;
	}
	
	/**
	   * Method for setting the value of maximum x value.
	   *
	   * @param xMax maximum value of x to set
	   */
	public void setXMax(double xMax)
	{
		this.xMax = xMax;
	}
	
	/**
	   * Method for setting the value of maximum y value.
	   *
	   * @param yMax maximum value of y to set
	   */
	public void setYMax(double yMax)
	{
		this.yMax=yMax;
	}

	/**
	 * This method checks if a point is inside the bounding box
	 * 
	 * @param x x-value of the point
	 * @param y y-value of the point
	 * @return inside?
	 */
	public boolean inside(double x, double y)
	{

		if(x<xMax && x>xMin && y<yMax && y>yMin)
			return true;
		else
			return false;
	}
	
	

}
